<table id="find_consume_info" data-options="fit:true"></table>
<div id="find_info" style="padding:0 10px;padding-left:20px;">
	<input class="icon-reload" type="button" value="刷新" onclick="javascript:flushConsume()"
		style="padding-left:20px;border:1px #999 solid;margin-right:20px;"/>
	校园卡卡号:
	<input style="text-align:center;" type="text" id="input_text_consume">
	<input type="button" value="查询" onclick="javascript:findConsume()"/>
</div>
<script>
$(function(){
	$('#find_consume_info').datagrid({
		url:'../expenseInfoServlet?t='+new Date(),
		queryParams:{op:"getAllConsume"},
		loadMsg:'数据加载中...',
		fitColumns:true,
		rownumbers:true,
		striped:true,
		sortName:'eid',
		sortOrder:'asc',
		remoteSort:false,
		columns:[[
			{field:'eid',title:'编号',width:100,align:'center',sortable:true},
			{field:'sid',title:'校园卡编号',width:100,align:'center'}, 
			{field:'etype',title:'消费类型',width:150,align:'center'}, 
			{field:'emoney',title:'消费金额',width:200,align:'center'}, 
			{field:'etime',title:'消费时间',width:200,align:'center'}
		]],
		toolbar:"#find_info"
	});
});

function findConsume() {
	var sid=$.trim($("#input_text_consume").val());
	if(sid!="") {
		$.post("../expenseInfoServlet?"+new Date(),{op:"getConsume",sid:sid},function(data){
			if(parseInt($.trim(data)) == 0) {
				$.messager.alert('错误提示','没有该信息!','error');
			} else {
				$("#find_consume_info").datagrid("loadData",data.rows);
			}
		},"json");
	}else{
		$.messager.show({
			title : '温馨提示',
			msg : '您输入的信息不完整，请确认后再提交!',
			timeout : 3000,
			showType : 'slide'
		});
	}
}

function flushConsume(){
	$('#find_consume_info').datagrid("reload");
}
</script>
